Fish biodiversity in Marine World Heritage Sites
This notebook explores fish diversity in Marine World Heritage Sites using OBIS data.
Fish species in WoRMS
First read all WoRMS species. As it’s not possible to get a full species list from the WoRMS or GBIF web services, I’m reading directly from an export provided by WoRMS.
library(dplyr)
worms <- read.csv("worms.txt", sep = "\t", quote = "") %>%
as_tibble() %>%
filter(taxonRank == "Species" & taxonomicStatus == "accepted") %>%
select(scientificName, phylum, class, order) %>%
mutate(species_fish = ifelse(class %in% c("Actinopterygii", "Coelacanthi", "Elasmobranchii", "Holocephali"), scientificName, NA))Here I’m using the rredlist package to get all Red List species from IUCN:
library(dplyr)
library(rredlist)
redlist <- tibble()
page <- 0
while (TRUE) {
res <- rl_sp(page, key = "a936c4f78881e79a326e73c4f97f34a6e7d8f9f9e84342bff73c3ceda14992b9")$result
if (length(res) == 0) {
break
}
redlist <- bind_rows(redlist, res)
page <- page + 1
}
redlist <- redlist %>%
as_tibble() %>%
filter(category %in% c("CR", "EN", "VU", "EW", "EX"))Now let’s label Red List species in the worms data frame.
worms <- worms %>%
mutate(species_vulnerable = ifelse(scientificName %in% redlist$scientific_name, scientificName, NA)) %>%
mutate(species_vulnerable_fish = ifelse(!is.na(species_fish) & scientificName %in% redlist$scientific_name, scientificName, NA)) And calculate some statistics:
worms %>%
summarize(
species = n(),
fish = length(unique(species_fish)),
vulnerable = length(unique(species_vulnerable)),
vulnerable_fish = length(unique(species_vulnerable_fish))
) %>%
kable(format.args = list(big.mark = ","))| species | fish | vulnerable | vulnerable_fish |
|---|---|---|---|
| 221,111 | 19,755 | 1,374 | 826 |
Fish data in OBIS
library(robis)
library(knitr)
if (!file.exists("checklist.Rdata")) {
cl <- checklist(dropped = "include")
cl <- cl %>%
filter(is_marine | is_brackish) %>%
mutate(species_fish = ifelse(superclass == "Pisces", species, NA)) %>%
mutate(species_vulnerable = ifelse(category %in% c("VU", "EN", "CR"), species, NA)) %>%
mutate(species_vulnerable_fish = ifelse(superclass == "Pisces" & category %in% c("VU", "EN", "CR"), species, NA))
save(cl, file = "checklist.Rdata")
} else {
load("checklist.Rdata")
}
cl %>%
summarize(
records = sum(records),
species = length(unique(species)),
fish = length(unique(species_fish)),
vulnerable = length(unique(species_vulnerable)),
vulnerable_fish = length(unique(species_vulnerable_fish))
) %>%
kable(format.args = list(big.mark = ","))| records | species | fish | vulnerable | vulnerable_fish |
|---|---|---|---|---|
| 73,980,477 | 134,463 | 16,923 | 1,035 | 604 |
Fish data for the Marine World Heritage Sites
Fetch spatial data
First fetch the Marine World Heritage Sites shapefile from MarineRegions:
library(sf)
library(dplyr)
if (!file.exists("shape/worldheritagemarineprogramme.shp")) {
download.file("http://geo.vliz.be/geoserver/wfs?request=getfeature&service=wfs&version=1.0.0&typename=MarineRegions:worldheritagemarineprogramme&outputformat=SHAPE-ZIP", "shape.zip")
unzip("shape.zip", exdir = "shape")
}
shapes <- st_read("shape/worldheritagemarineprogramme.shp") %>%
select(full_name, country, geometry) %>%
mutate(full_name = iconv(full_name, "latin1", "UTF-8"))## Reading layer `worldheritagemarineprogramme' from data source `/Users/pieter/Desktop/notebook-mwhs/shape/worldheritagemarineprogramme.shp' using driver `ESRI Shapefile'
## Simple feature collection with 129 features and 15 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -180 ymin: -55.00039 xmax: 180 ymax: 71.80583
## geographic CRS: WGS 84
Let’s create a map.